package com.chen.dome3charset;

import java.util.Arrays;

public class charsetdome {
    public static void main(String[] args) throws Exception {
        String name="我爱你中国asd123";
        byte[] bytes=name.getBytes("GBK");//默认使用utf-8进行编码
        System.out.println(bytes.length);
        System.out.println(Arrays.toString(bytes));

        String s=new String(bytes,"GBK");
        System.out.println(s);//解码默认使用utf-8
    }
}
